//
//  DataHandle.m
//  MyStock
//
//  Created by 刘翔 on 2024/10/25.
//

#import "DataHandle.h"

@implementation DataHandle
+ (NSString *)handleUnits:(long)digit{
    
    if (digit == 0) {
        return @"0.00";
    }else if (digit > 0 && digit < 10000){
        return [NSString stringWithFormat:@"%ld",digit];
    }else if (digit >= 10000 && digit < 100000000){
        return [NSString stringWithFormat:@"%d万",digit/10000];
    }else{
        return [NSString stringWithFormat:@"%.2f亿",digit/100000000.0];
    }
    
    
    return @"";
}

+ (UIColor *)handleColorWithDouble:(double)digit{
    
    if (digit > 0) {
        return Color_red;
    }else if (digit < 0){
        return Color_gree;
    }else{
        return [UIColor blackColor];

    }
}

+ (UIColor *)handleColorWithLong:(long)digit{
    
    if (digit > 0) {
        return Color_red;
    }else if (digit < 0){
        return Color_gree;
    }else{
        return[UIColor blackColor];

    }
}

+ (UIColor *)handleColorWithInt:(int)digit{
    
    if (digit > 0) {
        return Color_red;
    }else if (digit < 0){
        return Color_gree;
    }else{
        return[UIColor blackColor];

    }
}

@end
